﻿using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    /// <summary>
    /// 询价记录表
    /// </summary>
    public class InquiryDal : BaseDal<EAInquiry>
    {
        public override string tablename
        {
            get { return "EAInquiry"; }
        }

        public override Dictionary<string, bool> PKName
        {
            get
            {
                Dictionary<string, bool> dic = new Dictionary<string, bool>();
                dic.Add("inquiry_Id", true);
                return dic;
            }
        }

        /// <summary>
        /// 询价添加
        /// </summary>
        /// <param name="Inquiry"></param>
        /// <returns></returns>
        public bool InquiryAdd(EAInquiry Inquiry)
        {
            string sql = Common.Common.ToAddSql<EAInquiry>(Inquiry, tablename, PKName);
            return Common.DBHelp.GetExecuteNonQuery(sql);
        }

        /// <summary>
        /// 询价显示
        /// </summary>
        /// <returns></returns>
        public List<EAInquiry> InquiryList(string pro)
        {
            string sql = @"SELECT [Inquiry_Id]
      ,[ProjectNumber]
      ,[Inquiry_UnitPrice]
      ,[Inquiry_Content]
      ,[Inquiry_Time]
      ,[Inquiry_CreateTime]
      ,[Inquiry_CreatePeople]
  FROM [House].[dbo].[EAInquiry] where [ProjectNumber]='" + pro + "'";
            return DBHelper.ExecuteObjects<EAInquiry>(sql);
        }
    }
}
